package bookManage.model;

import java.io.Serializable;

import com.sun.org.apache.regexp.internal.recompile;

import Util.TestUtil;

public class BorrowModel implements Serializable {

	/**
	 * 序列化
	 */
	private static final long serialVersionUID = 1L;

	private Integer borrowCode;// 借阅记录编号
	private String cardId;// 借阅卡
	private String bookIsbn;// 借阅图书isbn
	private String borrowTime;// 借阅时间
	private String returnTime;// 归还时间

	public Integer getBorrowCode() {
		return borrowCode;
	}

	public void setBorrowCode() {// 借阅记录编号自动生成
		this.borrowCode = (int) (Math.random() * 2000000000 + 0);
	}

	public String getCardId() {
		return cardId;
	}

	public void setCardId(String cardId) {
		this.cardId = cardId;
	}

	public String getBookIsbn() {
		return bookIsbn;
	}

	public void setBookIsbn(String bookIsbn) {
		this.bookIsbn = bookIsbn;
	}

	public String getBorrowTime() {
		return borrowTime;
	}

	public void setBorrowTime() {
		this.borrowTime = TestUtil.time();
	}

	public String getReturnTime() {
		if (returnTime == null) {
			return "未归还";
		}
		return returnTime;
	}

	public void setReturnTime() {
		this.returnTime = TestUtil.time();
	}

	@Override
	public String toString() {
		return "BorrowModel [borrowCode=" + borrowCode + ", cardId=" + cardId + ", bookIsbn=" + bookIsbn
				+ ", borrowTime=" + borrowTime + ", returnTime=" + returnTime + "]";
	}

}
